package com.kyjszj.modules.product.service.impl;

import com.baomidou.mybatisplus.enums.SqlMethod;
import com.baomidou.mybatisplus.mapper.Wrapper;
import com.baomidou.mybatisplus.plugins.Page;
import com.kyjszj.core.common.service.impl.CommonServiceImpl;
import com.kyjszj.core.utils.APIUtils;
import com.kyjszj.modules.product.entity.Product;
import com.kyjszj.modules.product.mapper.ProductMapper;
import com.kyjszj.modules.product.service.IProductService;
import com.taobao.api.ApiException;
import org.apache.ibatis.session.SqlSession;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.io.IOException;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;

@Transactional
@Service
public class ProductServiceImpl extends CommonServiceImpl<ProductMapper, Product> implements IProductService {

    @Override
    protected Class<Product> currentModelClass() {
        return super.currentModelClass();
    }

    @Override
    protected SqlSession sqlSessionBatch() {
        return super.sqlSessionBatch();
    }

    @Override
    protected String sqlStatement(SqlMethod sqlMethod) {
        return super.sqlStatement(sqlMethod);
    }

    @Override
    public boolean insert(Product entity) {
        return super.insert(entity);
    }

    @Override
    public boolean insertAllColumn(Product entity) {
        return super.insertAllColumn(entity);
    }

    @Override
    public boolean insertBatch(List<Product> entityList) {
        return super.insertBatch(entityList);
    }

    @Override
    public boolean insertBatch(List<Product> entityList, int batchSize) {
        return super.insertBatch(entityList, batchSize);
    }

    @Override
    public boolean insertOrUpdate(Product entity) {
        return super.insertOrUpdate(entity);
    }

    @Override
    public boolean insertOrUpdateBatch(List<Product> entityList) {
        return super.insertOrUpdateBatch(entityList);
    }

    @Override
    public boolean insertOrUpdateBatch(List<Product> entityList, int batchSize) {
        return super.insertOrUpdateBatch(entityList, batchSize);
    }

    @Override
    public boolean deleteById(Serializable id) {
        return super.deleteById(id);
    }

    @Override
    public boolean deleteByMap(Map<String, Object> columnMap) {
        return super.deleteByMap(columnMap);
    }

    @Override
    public boolean delete(Wrapper<Product> wrapper) {
        return super.delete(wrapper);
    }

    @Override
    public boolean deleteBatchIds(List<? extends Serializable> idList) {
        return super.deleteBatchIds(idList);
    }

    @Override
    public boolean updateById(Product entity) {
        return super.updateById(entity);
    }

    @Override
    public boolean updateAllColumnById(Product entity) {
        return super.updateAllColumnById(entity);
    }

    @Override
    public boolean update(Product entity, Wrapper<Product> wrapper) {
        return super.update(entity, wrapper);
    }

    @Override
    public boolean updateBatchById(List<Product> entityList) {
        return super.updateBatchById(entityList);
    }

    @Override
    public boolean updateBatchById(List<Product> entityList, int batchSize) {
        return super.updateBatchById(entityList, batchSize);
    }

    @Override
    public Product selectById(Serializable id) {
        return super.selectById(id);
    }

    @Override
    public List<Product> selectBatchIds(List<? extends Serializable> idList) {
        return super.selectBatchIds(idList);
    }

    @Override
    public List<Product> selectByMap(Map<String, Object> columnMap) {
        return super.selectByMap(columnMap);
    }

    @Override
    public Product selectOne(Wrapper<Product> wrapper) {
        return super.selectOne(wrapper);
    }

    @Override
    public Map<String, Object> selectMap(Wrapper<Product> wrapper) {
        return super.selectMap(wrapper);
    }

    @Override
    public Object selectObj(Wrapper<Product> wrapper) {
        return super.selectObj(wrapper);
    }

    @Override
    public int selectCount(Wrapper<Product> wrapper) {
        return super.selectCount(wrapper);
    }

    @Override
    public List<Product> selectList(Wrapper<Product> wrapper) {
        return super.selectList(wrapper);
    }

    @Override
    public Page<Product> selectPage(Page<Product> page) {
        return super.selectPage(page);
    }

    @Override
    public List<Map<String, Object>> selectMaps(Wrapper<Product> wrapper) {
        return super.selectMaps(wrapper);
    }

    @Override
    public List<Object> selectObjs(Wrapper<Product> wrapper) {
        return super.selectObjs(wrapper);
    }

    @Override
    public Page<Map<String, Object>> selectMapsPage(Page page, Wrapper<Product> wrapper) {
        return super.selectMapsPage(page, wrapper);
    }

    @Override
    public Page<Product> selectPage(Page<Product> page, Wrapper<Product> wrapper) {
        return super.selectPage(page, wrapper);
    }


    @Override
    public void saveProduct() {
        List<Product> products = new ArrayList<Product>();
        try {
            APIUtils.haoQuanQingDan(this);
        } catch (ApiException e) {
            e.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}
